<!DOCTYPE html>
<html lang="zh-CN">
  <head>
  <meta charset="UTF-8">
  <meta 
    name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
  <meta 
    http-equiv="X-UA-Compatible" 
    content="ie=edge">
  <meta 
    name="theme-color" 
    content="#fff" 
    id="theme-color">
  <meta 
    name="description" 
    content="hexoDemo用于介绍如何使用hexo">
  <link 
    rel="icon" 
    href="/">
  <title>03-初识HTML</title>
  
    
      <meta 
        property="og:title" 
        content="03-初识HTML">
    
    
      <meta 
        property="og:url" 
        content="https://zwl5670.gitee.io/2001/01/01/01-HTML/03-%E5%88%9D%E8%AF%86HTML/index.html">
    
    
      <meta 
        property="og:img" 
        content="https://img.songhn.com/img/Y67gdd.png">
    
    
      <meta 
        property="og:img" 
        content="hexoDemo用于介绍如何使用hexo">
    
    
      <meta 
        property="og:type" 
        content="article">
      <meta 
        property="og:article:published_time" 
        content="2001-01-01">
      <meta 
        property="og:article:modified_time" 
        content="2023-03-14">
      <meta 
        property="og:article:author" 
        content="zwl5670">
      
        
          <meta 
            property="og:article:tag" 
            content="HTML">
        
      
    
  
  
  <link rel="preload" href="//at.alicdn.com/t/font_1946621_i1kgafibvw.css" as="style" >
  <link rel="preload" href="//at.alicdn.com/t/font_1952792_89b4ac4k4up.css" as="style" >
  <link rel="preload" href="/css/main.css" as="style" >
  
  <link rel="modulepreload" href="//instant.page/5.1.0">
  
  <link rel="stylesheet" href="/css/main.css">
  
  <link rel="stylesheet" href="//at.alicdn.com/t/font_1946621_i1kgafibvw.css">
  
  <link rel="stylesheet" href="//at.alicdn.com/t/font_1952792_89b4ac4k4up.css">
  
  
  
    <link rel="stylesheet" href="/js/lib/lightbox/baguetteBox.min.css">
  
  <script>
    function loadScript(url, cb) {
      var script = document.createElement('script');
      script.src = url;
      if (cb) script.onload = cb;
      script.async = true;
      document.body.appendChild(script);
    }
    function loadCSS(href, data, attr) {
      var sheet = document.createElement('link');
      sheet.ref = 'stylesheet';
      sheet.href = href;
      sheet.dataset[data] = attr;
      document.head.appendChild(sheet);
    }
    function changeCSS(cssFile, data, attr) {
      var oldlink = document.querySelector(data);
      var newlink = document.createElement("link");
      newlink.setAttribute("rel", "stylesheet");
      newlink.setAttribute("href", cssFile);
      newlink.dataset.prism = attr;
      document.head.replaceChild(newlink, oldlink);
    }
  </script>
  
    
  
  <script>
    // control reverse button
    var reverseDarkList = {
      dark: 'light',
      light: 'dark'
    };
    var themeColor = {
      dark: '#1c1c1e',
      light: '#fff'
    }
    // get the data of css prefers-color-scheme
    var getCssMediaQuery = function() {
      return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
    };
    // reverse current darkmode setting function
    var reverseDarkModeSetting = function() {
      var setting = localStorage.getItem('user-color-scheme');
      if(reverseDarkList[setting]) {
        setting = reverseDarkList[setting];
      } else if(setting === null) {
        setting = reverseDarkList[getCssMediaQuery()];
      } else {
        return;
      }
      localStorage.setItem('user-color-scheme', setting);
      return setting;
    };
    // apply current darkmode setting
  </script>
  
    <script>
      var setDarkmode = function(mode) {
      var setting = mode || localStorage.getItem('user-color-scheme');
      if(setting === getCssMediaQuery()) {
        document.documentElement.removeAttribute('data-user-color-scheme');
        localStorage.removeItem('user-color-scheme');
        document.getElementById('theme-color').content = themeColor[setting];
        document.getElementById('theme-color').dataset.mode = setting;
      } else if(reverseDarkList[setting]) {
        document.documentElement.setAttribute('data-user-color-scheme', setting);
        document.getElementById('theme-color').content = themeColor[setting];
        document.getElementById('theme-color').dataset.mode = setting;
      } else {
        document.documentElement.removeAttribute('data-user-color-scheme');
        localStorage.removeItem('user-color-scheme');
        document.getElementById('theme-color').content = themeColor[getCssMediaQuery()];
        document.getElementById('theme-color').dataset.mode = getCssMediaQuery();
      }
    };
    setDarkmode();
    </script>
  
  
  
    <link rel="preload" href="/js/lib/lightbox/baguetteBox.min.js" as="script">
    <link rel="preload" href="/js/lib/lightbox/baguetteBox.min.css" as="style" >
  
  
    <link rel="preload" href="/js/lib/lozad.min.js" as="script">
  
  
  
  
  
  
<meta name="generator" content="Hexo 6.3.0"></head>

  <body>
    <div class="wrapper">
       
      <nav class="navbar">
  <div class="navbar-logo">
    <a class="navbar-logo-main" href="/">
      
      <span class="navbar-logo-dsc">前端面试</span>
      </a>
  </div>
  <div class="navbar-menu">
    
      <a 
        href="/" 
        class="navbar-menu-item">
        
          首页
        
      </a>
    
      <a 
        href="/archives" 
        class="navbar-menu-item">
        
          归档
        
      </a>
    
      <a 
        href="/tags" 
        class="navbar-menu-item">
        
          标签
        
      </a>
    
      <a 
        href="/categories" 
        class="navbar-menu-item">
        
          分类
        
      </a>
    
      <a 
        href="/about" 
        class="navbar-menu-item">
        
          关于
        
      </a>
    
      <a 
        href="/links" 
        class="navbar-menu-item">
        
          友链
        
      </a>
    
    <button 
      class="navbar-menu-item darknavbar navbar-menu-btn" 
      aria-label="Toggle dark mode"
      id="dark">
      <i class="iconfont icon-weather"></i>
    </button>
    <button 
      class="navbar-menu-item searchnavbar navbar-menu-btn" 
      aria-label="Toggle search"
      id="search">
      <!-- <i 
        class="iconfont icon-search" 
        style="font-size: 1.2rem; font-weight: 400;">
      </i> -->
      <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img"
        class="iconify iconify--ion" width="28" height="28" preserveAspectRatio="xMidYMid meet" viewBox="0 0 512 512">
        <path fill="none" stroke="currentColor" stroke-miterlimit="10" stroke-width="28"
          d="M256 80a176 176 0 1 0 176 176A176 176 0 0 0 256 80Z"></path>
        <path fill="none" stroke="currentColor" stroke-miterlimit="10" stroke-width="28"
          d="M232 160a72 72 0 1 0 72 72a72 72 0 0 0-72-72Z"></path>
        <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="28"
          d="M283.64 283.64L336 336"></path>
      </svg>
    </button>
  </div>
</nav> 
      
      <div 
        id="local-search" 
        style="display: none">
        <input
          class="navbar-menu-item"
          id="search-input"
          placeholder="请输入搜索内容..." />
        <div id="search-content"></div>
      </div>
      
      <div class="section-wrap">
        <div class="container">
          <div class="columns">
            <aside class="left-column">
              
              <div class="card card-author">
                
  <img 
    src="https://img.songhn.com/img/Y67gdd.png" 
    class="author-img"
    width="88"
    height="88"
    alt="author avatar">

<p class="author-name">zwl5670</p>
<p class="author-description">前端学习资料</p>
<div class="author-message">
  <a 
    class="author-posts-count" 
    href="/archives">
    <span>215</span>
    <span>文章</span>
  </a>
  <a 
    class="author-categories-count" 
    href="/categories">
    <span>14</span>
    <span>分类</span>
  </a>
  <a 
    class="author-tags-count" 
    href="/tags">
    <span>14</span>
    <span>标签</span>
  </a>
</div>

              </div>
               <div class="sticky-tablet">
  
  
    <article class="display-when-two-columns spacer">
      <div class="card card-content toc-card">
        <div class="toc-header">
  <i 
    class="iconfont icon-menu" 
    style="padding-right: 2px;">
  </i>目录
</div>
<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%BC%96%E8%BE%91%E5%99%A8%E7%9B%B8%E5%85%B3"><span class="toc-text">编辑器相关</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#VS-Code-%E7%9A%84%E4%BD%BF%E7%94%A8"><span class="toc-text">VS Code 的使用</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Sublime-Text-%E7%9A%84%E4%BD%BF%E7%94%A8"><span class="toc-text">Sublime Text 的使用</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#HTML%E7%9A%84%E6%A6%82%E8%BF%B0"><span class="toc-text">HTML的概述</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#HTML%E7%9A%84%E6%A6%82%E5%BF%B5"><span class="toc-text">HTML的概念</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%A6%82%E5%BF%B5%EF%BC%9A%E8%B6%85%E6%96%87%E6%9C%AC"><span class="toc-text">概念：超文本</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%A6%82%E5%BF%B5%EF%BC%9A%E6%A0%87%E8%AE%B0%E8%AF%AD%E8%A8%80"><span class="toc-text">概念：标记语言</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#HTML%E6%98%AF%E8%B4%9F%E8%B4%A3%E6%8F%8F%E8%BF%B0%E6%96%87%E6%A1%A3%E8%AF%AD%E4%B9%89%E7%9A%84%E8%AF%AD%E8%A8%80"><span class="toc-text">HTML是负责描述文档语义的语言</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#HTML%E7%9A%84%E5%8E%86%E5%8F%B2"><span class="toc-text">HTML的历史</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#HTML%E7%9A%84%E4%B8%93%E6%9C%89%E5%90%8D%E8%AF%8D"><span class="toc-text">HTML的专有名词</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B9%A6%E5%86%99%E7%AC%AC%E4%B8%80%E4%B8%AA-HTML-%E9%A1%B5%E9%9D%A2"><span class="toc-text">书写第一个 HTML 页面</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#HTML%E7%BB%93%E6%9E%84%E8%AF%A6%E8%A7%A3"><span class="toc-text">HTML结构详解</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#html%E9%AA%A8%E6%9E%B6%E6%A0%87%E7%AD%BE%E5%88%86%E7%B1%BB"><span class="toc-text">html骨架标签分类</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%BF%AB%E9%80%9F%E7%94%9F%E6%88%90-html-%E7%9A%84%E9%AA%A8%E6%9E%B6"><span class="toc-text">快速生成 html 的骨架</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#1%E3%80%81%E6%96%87%E6%A1%A3%E5%A3%B0%E6%98%8E%E5%A4%B4"><span class="toc-text">1、文档声明头</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#HTML4-01%E6%9C%89%E5%93%AA%E4%BA%9B%E8%A7%84%E8%8C%83%E5%91%A2%EF%BC%9F"><span class="toc-text">HTML4.01有哪些规范呢？</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2%E3%80%81%E9%A1%B5%E9%9D%A2%E8%AF%AD%E8%A8%80-lang"><span class="toc-text">2、页面语言 lang</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3%E3%80%81%E5%A4%B4%E6%A0%87%E7%AD%BE-head"><span class="toc-text">3、头标签 head</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#html5-%E7%9A%84%E6%AF%94%E8%BE%83%E5%AE%8C%E6%95%B4%E7%9A%84%E9%AA%A8%E6%9E%B6%EF%BC%9A"><span class="toc-text">html5 的比较完整的骨架：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4%E3%80%81-lt-body-gt-%E6%A0%87%E7%AD%BE"><span class="toc-text">4、&lt;body&gt;标签</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BC%96%E7%A0%81%E4%BB%8B%E7%BB%8D"><span class="toc-text">计算机编码介绍</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#HTML%E7%9A%84%E8%A7%84%E8%8C%83"><span class="toc-text">HTML的规范</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1%E3%80%81%E7%BC%96%E5%86%99XHTML%E7%9A%84%E8%A7%84%E8%8C%83%EF%BC%9A"><span class="toc-text">1、编写XHTML的规范：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2%E3%80%81HTML%E7%9A%84%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95%E7%89%B9%E6%80%A7"><span class="toc-text">2、HTML的基本语法特性</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%EF%BC%881%EF%BC%89HTML%E5%AF%B9%E6%8D%A2%E8%A1%8C%E4%B8%8D%E6%95%8F%E6%84%9F%EF%BC%8C%E5%AF%B9tab%E4%B8%8D%E6%95%8F%E6%84%9F"><span class="toc-text">（1）HTML对换行不敏感，对tab不敏感</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%EF%BC%882%EF%BC%89%E7%A9%BA%E7%99%BD%E6%8A%98%E5%8F%A0%E7%8E%B0%E8%B1%A1"><span class="toc-text">（2）空白折叠现象</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%EF%BC%883%EF%BC%89%E6%A0%87%E7%AD%BE%E8%A6%81%E4%B8%A5%E6%A0%BC%E5%B0%81%E9%97%AD"><span class="toc-text">（3）标签要严格封闭</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%88%91%E7%9A%84%E5%85%AC%E4%BC%97%E5%8F%B7"><span class="toc-text">我的公众号</span></a></li></ol>
      </div>
    </article>
  
  
  <article class="card card-content categories-widget">
    <div class="categories-card">
  <div class="categories-header">
    <i 
      class="iconfont icon-fenlei" 
      style="padding-right: 2px;">
    </i>分类
  </div>
  <div class="categories-list">
    
      <a href="/categories/%E5%89%8D%E7%AB%AF%E5%B7%A5%E5%85%B7/">
        <div class="categories-list-item">
          前端工具
          <span class="categories-list-item-badge">13</span>
        </div>
      </a>
    
      <a href="/categories/CSS%E5%9F%BA%E7%A1%80/">
        <div class="categories-list-item">
          CSS基础
          <span class="categories-list-item-badge">18</span>
        </div>
      </a>
    
      <a href="/categories/CSS%E8%BF%9B%E9%98%B6/">
        <div class="categories-list-item">
          CSS进阶
          <span class="categories-list-item-badge">9</span>
        </div>
      </a>
    
      <a href="/categories/HTML/">
        <div class="categories-list-item">
          HTML
          <span class="categories-list-item-badge">12</span>
        </div>
      </a>
    
      <a href="/categories/JS%E5%9F%BA%E7%A1%80/">
        <div class="categories-list-item">
          JS基础
          <span class="categories-list-item-badge">56</span>
        </div>
      </a>
    
      <a href="/categories/JS%E5%9F%BA%E7%A1%80ES6/">
        <div class="categories-list-item">
          JS基础ES6
          <span class="categories-list-item-badge">10</span>
        </div>
      </a>
    
      <a href="/categories/JS%E5%9F%BA%E7%A1%80%E5%BC%82%E6%AD%A5/">
        <div class="categories-list-item">
          JS基础异步
          <span class="categories-list-item-badge">11</span>
        </div>
      </a>
    
      <a href="/categories/JS%E8%BF%9B%E9%98%B6/">
        <div class="categories-list-item">
          JS进阶
          <span class="categories-list-item-badge">11</span>
        </div>
      </a>
    
      <a href="/categories/%E7%A7%BB%E5%8A%A8web/">
        <div class="categories-list-item">
          移动web
          <span class="categories-list-item-badge">3</span>
        </div>
      </a>
    
      <a href="/categories/CSS%E5%92%8CDOM/">
        <div class="categories-list-item">
          CSS和DOM
          <span class="categories-list-item-badge">6</span>
        </div>
      </a>
    
      <a href="/categories/Node/">
        <div class="categories-list-item">
          Node
          <span class="categories-list-item-badge">16</span>
        </div>
      </a>
    
      <a href="/categories/Vue%E5%9F%BA%E7%A1%80/">
        <div class="categories-list-item">
          Vue基础
          <span class="categories-list-item-badge">15</span>
        </div>
      </a>
    
      <a href="/categories/%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96/">
        <div class="categories-list-item">
          性能优化
          <span class="categories-list-item-badge">7</span>
        </div>
      </a>
    
      <a href="/categories/%E5%89%8D%E7%AB%AF%E5%B7%A5%E7%A8%8B%E5%8C%96/">
        <div class="categories-list-item">
          前端工程化
          <span class="categories-list-item-badge">8</span>
        </div>
      </a>
    
  </div>
</div>
  </article>
  
  <article class="card card-content tags-widget">
    <div class="tags-card">
  <div class="tags-header">
    <i 
      class="iconfont icon-biaoqian" 
      style="padding-right: 2px;">
    </i>热门标签
  </div>
  <div class="tags-list">
    
      <a 
        href="/tags/JS%E5%9F%BA%E7%A1%80/" 
        title="JS基础">
        <div class="tags-list-item">JS基础</div>
      </a>
    
      <a 
        href="/tags/CSS%E5%9F%BA%E7%A1%80/" 
        title="CSS基础">
        <div class="tags-list-item">CSS基础</div>
      </a>
    
      <a 
        href="/tags/Node/" 
        title="Node">
        <div class="tags-list-item">Node</div>
      </a>
    
      <a 
        href="/tags/Vue%E5%9F%BA%E7%A1%80/" 
        title="Vue基础">
        <div class="tags-list-item">Vue基础</div>
      </a>
    
      <a 
        href="/tags/%E5%89%8D%E7%AB%AF%E5%B7%A5%E5%85%B7/" 
        title="前端工具">
        <div class="tags-list-item">前端工具</div>
      </a>
    
      <a 
        href="/tags/HTML/" 
        title="HTML">
        <div class="tags-list-item">HTML</div>
      </a>
    
      <a 
        href="/tags/JS%E8%BF%9B%E9%98%B6/" 
        title="JS进阶">
        <div class="tags-list-item">JS进阶</div>
      </a>
    
      <a 
        href="/tags/JS%E5%9F%BA%E7%A1%80%E5%BC%82%E6%AD%A5/" 
        title="JS基础异步">
        <div class="tags-list-item">JS基础异步</div>
      </a>
    
      <a 
        href="/tags/JS%E5%9F%BA%E7%A1%80ES6/" 
        title="JS基础ES6">
        <div class="tags-list-item">JS基础ES6</div>
      </a>
    
      <a 
        href="/tags/CSS%E8%BF%9B%E9%98%B6/" 
        title="CSS进阶">
        <div class="tags-list-item">CSS进阶</div>
      </a>
    
      <a 
        href="/tags/%E5%89%8D%E7%AB%AF%E5%B7%A5%E7%A8%8B%E5%8C%96/" 
        title="前端工程化">
        <div class="tags-list-item">前端工程化</div>
      </a>
    
      <a 
        href="/tags/%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96/" 
        title="性能优化">
        <div class="tags-list-item">性能优化</div>
      </a>
    
      <a 
        href="/tags/CSS%E5%92%8CDOM/" 
        title="CSS和DOM">
        <div class="tags-list-item">CSS和DOM</div>
      </a>
    
      <a 
        href="/tags/%E7%A7%BB%E5%8A%A8web/" 
        title="移动web">
        <div class="tags-list-item">移动web</div>
      </a>
    
  </div>
</div>
  </article>
  
  
</div>
            </aside>
            <main class="main-column">
              
<article class="card card-content">
  <header>
    <h1 class="post-title">
      03-初识HTML
    </h1>
  </header>
  <div class="post-meta post-show-meta">
    <time datetime="2000-12-31T16:00:00.000Z">
      <i 
        class="iconfont icon-calendar" 
        style="margin-right: 2px;">
      </i>
      <span>2001-01-01</span>
    </time>
    
      <span class="dot"></span>
      
        <a 
          href="/categories/HTML/" 
          class="post-meta-link">
          HTML
        </a>
      
    
    
      <span class="dot"></span>
      <span>5.3k 字</span>
    
  </div>
  
    <div 
      class="post-meta post-show-meta" 
      style="margin-top: -10px;">
      <div style="display: flex; align-items: center;">
        <i 
          class="iconfont icon-biaoqian" 
          style="margin-right: 2px; font-size: 1.15rem;">
        </i>
        
          
          <a 
            href="/tags/HTML/" 
            class="post-meta-link">
            HTML
          </a>
        
      </div>
    </div>
  
  </header>
  <div 
    id="section" 
    class="post-content">
    <p><ArticleTopAd></ArticleTopAd></p>
<h2 id="编辑器相关"><a href="#编辑器相关" class="headerlink" title="编辑器相关"></a>编辑器相关</h2><p>前端开发的编辑器软件，我首先推荐 VS Code，其次推荐Sublime Text。</p>
<p>有人说 WebStorm 也不错？但真实情况是，自从VS Code 问世之后，用 WebStorm 的人越来越少了。</p>
<p>PS：文件的后缀名不能决定文件格式，只能决定打开文件打开的方式。</p>
<h3 id="VS-Code-的使用"><a href="#VS-Code-的使用" class="headerlink" title="VS Code 的使用"></a>VS Code 的使用</h3><p>详情请移步至：<a target="_blank" rel="noopener" href="https://github.com/qianguyihao/Web/blob/master/00-%E5%89%8D%E7%AB%AF%E5%B7%A5%E5%85%B7/01-VS%20Code%E7%9A%84%E4%BD%BF%E7%94%A8.md">第一次使用VS Code时你应该知道的一切配置</a></p>
<h3 id="Sublime-Text-的使用"><a href="#Sublime-Text-的使用" class="headerlink" title="Sublime Text 的使用"></a>Sublime Text 的使用</h3><p>详情请移步至：<a target="_blank" rel="noopener" href="https://github.com/qianguyihao/Mac/blob/master/03-%E5%85%A8%E5%B9%B3%E5%8F%B0%E8%BD%AF%E4%BB%B6/Sublime%20Text%E4%BD%BF%E7%94%A8%E6%8A%80%E5%B7%A7.md">Sublime Text使用技巧</a></p>
<h2 id="HTML的概述"><a href="#HTML的概述" class="headerlink" title="HTML的概述"></a>HTML的概述</h2><h3 id="HTML的概念"><a href="#HTML的概念" class="headerlink" title="HTML的概念"></a>HTML的概念</h3><p><strong>HTML</strong> 全称为 HyperText Markup Language，译为<font color=#0000ff><strong>超文本标记语言</strong></font>。</p>
<p>HTML 不是一种编程语言，是一种描述性的<strong>标记语言</strong>。</p>
<p><strong>作用</strong>：HTML是负责描述文档<strong>语义</strong>的语言。</p>
<h3 id="概念：超文本"><a href="#概念：超文本" class="headerlink" title="概念：超文本"></a>概念：超文本</h3><p>所谓的超文本，有两层含义：</p>
<p>（1）图片、音频、视频、动画、多媒体等内容，成为超文本，因为它们超出了文本的限制。</p>
<p>（2）不仅如此，它还可以从一个文件跳转到另一个文件，与世界各地主机的文件进行连接。即：超级链接文本。</p>
<h3 id="概念：标记语言"><a href="#概念：标记语言" class="headerlink" title="概念：标记语言"></a>概念：标记语言</h3><p>HTML 不是一种编程语言，是一种描述性的<strong>标记语言</strong>。这主要有两层含义：</p>
<p>（1）<strong>标记语言是一套标记标签</strong>。比如：标签<code>&lt;a&gt;</code>表示超链接、标签<code>&lt;img&gt;</code>表示图片、标签<code>&lt;h1&gt;</code>表示一级标题等等，它们都是属于 HTML 标签。</p>
<p>说的通俗一点就是：网页是由网页元素组成的，这些元素是由 HTML 标签描述出来，然后通过浏览器解析，就可以显示给用户看了。</p>
<p>（2）编程语言是有编译过程的，而标记语言没有编译过程，HTML标签是直接由浏览器解析执行。</p>
<h3 id="HTML是负责描述文档语义的语言"><a href="#HTML是负责描述文档语义的语言" class="headerlink" title="HTML是负责描述文档语义的语言"></a>HTML是负责描述文档语义的语言</h3><p>HTML 格式的文件是一个纯本文文件（就是用txt文件改名而成），用一些标签来描述语义，这些标签在浏览器页面上是无法直观看到的，所以称之为“超文本标记语言”。</p>
<p>接下来，我们需要学习 HTML 中的很多“标签对儿”，这些“标签对儿”能够给文本不同的语义。</p>
<p>比如，面试的时候问你，<code>&lt;h1&gt;</code> 标签有什么作用？</p>
<ul>
<li>正确答案：给文本增加主标题的语义。</li>
<li>错误答案：给文字加粗、加黑、变大。</li>
</ul>
<p>关乎“语义”的更深刻理解，等接下来我们学习了各种标签，就明白了。</p>
<h2 id="HTML的历史"><a href="#HTML的历史" class="headerlink" title="HTML的历史"></a>HTML的历史</h2><p><img src="http://img.smyhvae.com/20151001_1001.png" alt="html中标签发展趋势" srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="http://img.smyhvae.com/20151001_1001.png" class="lozad post-image"></p>
<p>其中，我们专门来对XHTML做一个介绍。</p>
<p><strong>XHTML介绍：</strong><br>XHTML：Extensible Hypertext Markup Language，可扩展超文本标注语言。<br>XHTML的主要目的是为了<font color="blue"><strong>取代HTML</strong></font>，也可以理解为HTML的升级版。<br>HTML的标记书写很不规范，会造成其它的设备(ipad、手机、电视等)无法正常显示。<br>XHTML与HTML4.0的标记基本上一样。<br>XHTML是<font color="blue"><strong>严格的、纯净的</strong></font>HTML。</p>
<p>我们稍后将对XHTML的编写规范进行介绍。</p>
<h2 id="HTML的专有名词"><a href="#HTML的专有名词" class="headerlink" title="HTML的专有名词"></a>HTML的专有名词</h2><ul>
<li>网页 ：由各种标记组成的一个页面就叫网页。</li>
<li>主页(首页) : 一个网站的起始页面或者导航页面。</li>
<li>标记：  比如<code>&lt;p&gt;</code>称为开始标记 ，<code>&lt;/p&gt;</code>称为结束标记，也叫标签。每个标签都规定好了特殊的含义。</li>
<li>元素：比如<code>&lt;p&gt;内容&lt;/p&gt;</code>称为元素.</li>
<li>属性：给每一个标签所做的辅助信息。</li>
<li>XHTML：符合XML语法标准的HTML。</li>
<li>DHTML：dynamic，动态的。<code>javascript + css + html</code>合起来的页面就是一个 DHTML。</li>
<li>HTTP：超文本传输协议。用来规定客户端浏览器和服务端交互时数据的一个格式。SMTP：邮件传输协议，FTP：文件传输协议。</li>
</ul>
<h2 id="书写第一个-HTML-页面"><a href="#书写第一个-HTML-页面" class="headerlink" title="书写第一个 HTML 页面"></a>书写第一个 HTML 页面</h2><p>我们打开 VS Code 软件，新建一个文件，名叫<code>test.html</code>（注意，文件名是<code>test</code>，后缀名是<code>html</code>），保存到本地。</p>
<p>紧接着，在文件里，输入<code>html:5</code>，然后按一下键盘上的<code>Tab</code>键，就可以自动生成如下内容：</p>
<pre class="highlight"><span class="line"><span class="meta">&lt;!DOCTYPE <span class="keyword">html</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">html</span> <span class="attr">lang</span>=<span class="string">&quot;en&quot;</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">head</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">&quot;UTF-8&quot;</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">meta</span> <span class="attr">name</span>=<span class="string">&quot;viewport&quot;</span> <span class="attr">content</span>=<span class="string">&quot;width=device-width, initial-scale=1.0&quot;</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">title</span>&gt;</span>Document<span class="tag">&lt;/<span class="name">title</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">head</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">body</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;/<span class="name">body</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">html</span>&gt;</span></span><br></pre>

<p>上面的内容，就是 html 页面的骨架。我们在此基础之上，新增几个标签，完整代码如下：</p>
<pre class="highlight"><span class="line"><span class="meta">&lt;!DOCTYPE <span class="keyword">html</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">html</span> <span class="attr">lang</span>=<span class="string">&quot;en&quot;</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">head</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">&quot;UTF-8&quot;</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">meta</span> <span class="attr">name</span>=<span class="string">&quot;viewport&quot;</span> <span class="attr">content</span>=<span class="string">&quot;width=device-width, initial-scale=1.0&quot;</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">title</span>&gt;</span>Document<span class="tag">&lt;/<span class="name">title</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">head</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">body</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">h3</span>&gt;</span>我是三级标题<span class="tag">&lt;/<span class="name">h3</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">img</span> <span class="attr">src</span>=<span class="string">&quot;&quot;</span> <span class="attr">alt</span>=<span class="string">&quot;&quot;</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">a</span> <span class="attr">href</span>=<span class="string">&quot;https://www.jd.com&quot;</span>&gt;</span>我是超链接，可以点击一下<span class="tag">&lt;/<span class="name">a</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">body</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">html</span>&gt;</span></span><br><span class="line"></span><br></pre>

<p>标签写完之后，我们用 chrome 浏览器打开上面这个<code>test.html</code>文件，看看页面效果：</p>
<p>到此，第一个简单的 HTML 页面就写完了。是不是很有成就感？</p>
<h2 id="HTML结构详解"><a href="#HTML结构详解" class="headerlink" title="HTML结构详解"></a>HTML结构详解</h2><p>HTML标签通常是成对出现的（<font color="blue"><strong>双边标记</strong></font>），比如 <code>&lt;div&gt;</code> 和 <code>&lt;/div&gt;</code>；也有少部分单标签（<font color="blue"><strong>单边标记</strong></font>），如：<code>&lt;br /&gt;</code>、<code>&lt;hr /&gt;</code>和<code>&lt;img src=&quot;images/1.jpg&quot; /&gt;</code>等。</p>
<p>属性与标记之间、各属性之间需要以空格隔开。属性值以双引号括起来。</p>
<h4 id="html骨架标签分类"><a href="#html骨架标签分类" class="headerlink" title="html骨架标签分类"></a>html骨架标签分类</h4><table>
<thead>
<tr>
<th>标签名</th>
<th align="center">定义</th>
<th align="left">说明</th>
</tr>
</thead>
<tbody><tr>
<td><code>&lt;html&gt;&lt;/html&gt;</code></td>
<td align="center">HTML标签</td>
<td align="left">页面中最大的标签，我们成为根标签</td>
</tr>
<tr>
<td><code>&lt;head&gt;&lt;/head&gt;</code></td>
<td align="center">文档的头部</td>
<td align="left">注意在head标签中我们必须要设置的标签是title</td>
</tr>
<tr>
<td><code>&lt;title&gt;&lt;/title&gt;</code></td>
<td align="center">文档的标题</td>
<td align="left">让页面拥有一个属于自己的网页标题</td>
</tr>
<tr>
<td><code>&lt;body&gt;&lt;/body&gt;</code></td>
<td align="center">文档的主体</td>
<td align="left">元素包含文档的所有内容，页面内容 基本都是放到body里面的</td>
</tr>
</tbody></table>
<h3 id="快速生成-html-的骨架"><a href="#快速生成-html-的骨架" class="headerlink" title="快速生成 html 的骨架"></a>快速生成 html 的骨架</h3><p><strong>方式1</strong>：在 VS Code 中新建 html 文件，输入<code>html:5</code>，按 <code>Tab</code>键后，自动生成的代码如下：</p>
<pre class="highlight"><span class="line"><span class="meta">&lt;!DOCTYPE <span class="keyword">html</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">html</span> <span class="attr">lang</span>=<span class="string">&quot;en&quot;</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">head</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">&quot;UTF-8&quot;</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">meta</span> <span class="attr">name</span>=<span class="string">&quot;viewport&quot;</span> <span class="attr">content</span>=<span class="string">&quot;width=device-width, initial-scale=1.0&quot;</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">&quot;Content-Type&quot;</span> <span class="attr">content</span>=<span class="string">&quot;text/html;charset=UTF-8&quot;</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">title</span>&gt;</span>Document<span class="tag">&lt;/<span class="name">title</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">head</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">body</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;/<span class="name">body</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">html</span>&gt;</span></span><br><span class="line"></span><br></pre>

<p><strong>方式2</strong>：在Sublime Text中安装<code>Emmet</code>插件。新建html文件，输入<code>html:5</code>，按<code>Tab</code>键后，自动生成的代码如下：</p>
<pre class="highlight"><span class="line"><span class="meta">&lt;!DOCTYPE <span class="keyword">html</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">html</span> <span class="attr">lang</span>=<span class="string">&quot;en&quot;</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">head</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">&quot;UTF-8&quot;</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">title</span>&gt;</span>Document<span class="tag">&lt;/<span class="name">title</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">head</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">body</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;/<span class="name">body</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">html</span>&gt;</span></span><br></pre>

<p><strong>方式3</strong>：在Sublime Text中安装<code>Emmet</code>插件。新建html文件，输入<code>html:xt</code>，按<code>Tab</code>键后，自动生成的代码如下：</p>
<pre class="highlight"><span class="line"><span class="meta">&lt;!DOCTYPE <span class="keyword">html</span> <span class="keyword">PUBLIC</span> <span class="string">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span> <span class="string">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">html</span> <span class="attr">xmlns</span>=<span class="string">&quot;http://www.w3.org/1999/xhtml&quot;</span> <span class="attr">xml:lang</span>=<span class="string">&quot;en&quot;</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">head</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">&quot;Content-Type&quot;</span> <span class="attr">content</span>=<span class="string">&quot;text/html;charset=UTF-8&quot;</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">title</span>&gt;</span>Document<span class="tag">&lt;/<span class="name">title</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">head</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">body</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;/<span class="name">body</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">html</span>&gt;</span></span><br></pre>

<p>上面的方式2和方式3中，我们会发现，第一行的内容有些不太一样，这就是我们接下来要讲的<strong>文档声明头</strong>。</p>
<h3 id="1、文档声明头"><a href="#1、文档声明头" class="headerlink" title="1、文档声明头"></a>1、文档声明头</h3><p>任何一个标准的HTML页面，第一行一定是一个以<code>&lt;!DOCTYPE ……&gt;</code>开头的语句。这一行，就是文档声明头，即 DocType Declaration，简称DTD。</p>
<p><strong>DTD可告知浏览器文档使用哪种 HTML 或 XHTML 规范</strong>。</p>
<h4 id="HTML4-01有哪些规范呢？"><a href="#HTML4-01有哪些规范呢？" class="headerlink" title="HTML4.01有哪些规范呢？"></a>HTML4.01有哪些规范呢？</h4><p><strong>HTML4.01</strong>这个版本是IE6开始兼容的。<strong>HTML5是IE9开始兼容的</strong>。如今，手机、移动端的网页，就可以使用HTML5了，因为其兼容性更高。</p>
<p>说个题外话，html1 至 html3 是美国军方以及高等研究所用的，并未对外公开。</p>
<p>HTML4.01里面有两大种规范，每大种规范里面又各有3种小规范。所以一共6种规范（见下图）。</p>
<p>HTML4.01里面规定了<strong>普通</strong>和<strong>XHTML</strong>两大种规范。HTML觉得自己有一些规定不严谨，比如，标签是否可以用大写字母呢？<code>&lt;H1&gt;&lt;/H1&gt;</code>所以，HTML就觉得，把一些规范严格的标准，又制定了一个XHTML1.0。在XHTML中的字母X，表示“严格的”。</p>
<p>总结一下，HTML4.01一共有6种DTD。说白了，HTML的第一行语句一共有6种情况：</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="http://img.smyhvae.com/20170629_1600.png" class="lozad post-image"src="http://img.smyhvae.com/20170629_1600.png"></p>
<p>下面对上图中的三种小规范进行解释：</p>
<p><strong>strict</strong>：</p>
<p>表示“严格的”，这种模式里面的要求更为严格。这种严格体现在哪里？有一些标签不能使用。<br>比如，u标签，就是给一个本文加下划线，但是这和HTML的本质有冲突，因为HTML最好是只负责语义，不要负责样式，而u这个下划线是样式。所以，在strict中是不能使用u标签的。</p>
<p>那怎么给文本增加下划线呢？今后将使用css属性来解决。</p>
<p>XHTML1.0更为严格，因为这个体系本身规定比如标签必须是小写字母、必须严格闭合标签、必须使用引号引起属性等等。</p>
<p><strong>Transitional</strong>：表示“普通的”，这种模式就是没有一些别的规范。</p>
<p><strong>Frameset</strong>：表示“框架”，在框架的页面使用。</p>
<p>在sublime输入的html:xt，x表示XHTML，t表示transitional。</p>
<p>在HTML5中极大的简化了DTD，也就是说HTML5中就没有XHTML了。HTML5的DTD（文档声明头）如下：</p>
<pre class="highlight"><span class="line">&lt;!DOCTYPE html&gt;</span><br></pre>

<h3 id="2、页面语言-lang"><a href="#2、页面语言-lang" class="headerlink" title="2、页面语言 lang"></a>2、页面语言 <code>lang</code></h3><p>下面这行标签，用于指定页面的语言类型：</p>
<pre class="highlight"><span class="line"><span class="tag">&lt;<span class="name">html</span> <span class="attr">lang</span>=<span class="string">&quot;en&quot;</span>&gt;</span></span><br></pre>

<p>最常见的语言类型有两种：</p>
<ul>
<li><p>en：定义页面语言为英语。</p>
</li>
<li><p>zh-CN：定义页面语言为中文。</p>
</li>
</ul>
<h3 id="3、头标签-head"><a href="#3、头标签-head" class="headerlink" title="3、头标签 head"></a>3、头标签 <code>head</code></h3><h4 id="html5-的比较完整的骨架："><a href="#html5-的比较完整的骨架：" class="headerlink" title="html5 的比较完整的骨架："></a>html5 的比较完整的骨架：</h4><pre class="highlight"><span class="line"><span class="meta">&lt;!DOCTYPE <span class="keyword">html</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">html</span> <span class="attr">lang</span>=<span class="string">&quot;en&quot;</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">head</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">&quot;UTF-8&quot;</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">meta</span> <span class="attr">name</span>=<span class="string">&quot;viewport&quot;</span> <span class="attr">content</span>=<span class="string">&quot;width=device-width, initial-scale=1.0&quot;</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">&quot;Content-Type&quot;</span> <span class="attr">content</span>=<span class="string">&quot;text/html;charset=UTF-8&quot;</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">meta</span> <span class="attr">name</span>=<span class="string">&quot;Author&quot;</span> <span class="attr">content</span>=<span class="string">&quot;&quot;</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">meta</span> <span class="attr">name</span>=<span class="string">&quot;Keywords&quot;</span> <span class="attr">content</span>=<span class="string">&quot;厉害很厉害&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">meta</span> <span class="attr">name</span>=<span class="string">&quot;Description&quot;</span> <span class="attr">content</span>=<span class="string">&quot;网易是中国领先的互联网技术公司，为用户提供免费邮箱、游戏、搜索引擎服务，开设新闻、娱乐、体育等30多个内容频道，及博客、视频、论坛等互动交流，网聚人的力量。&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">title</span>&gt;</span>Document<span class="tag">&lt;/<span class="name">title</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">head</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">body</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;/<span class="name">body</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">html</span>&gt;</span></span><br></pre>

<p>面试题：</p>
<ul>
<li>问：网页的head标签里面，表示的是页面的配置，有什么配置？</li>
<li>答：字符集、关键词、页面描述、页面标题、IE适配、视口、iPhone小图标等等。</li>
</ul>
<p>头标签内部的常见标签如下：</p>
<ul>
<li><code>&lt;title&gt;</code>：指定整个网页的标题，在浏览器最上方显示。</li>
<li><code>&lt;base&gt;</code>：为页面上的所有链接规定默认地址或默认目标。</li>
<li><code>&lt;meta&gt;</code>：提供有关页面的基本信息</li>
<li><code>&lt;body&gt;</code>：用于定义HTML文档所要显示的内容，也称为主体标签。我们所写的代码必须放在此标签內。</li>
<li><code>&lt;link&gt;</code>：定义文档与外部资源的关系。</li>
</ul>
<p><strong>meta 标签</strong>：</p>
<p>meta表示“元”。“元”配置，就是表示基本的配置项目。</p>
<p>常见的几种 meta 标签如下：</p>
<p>（1）字符集 charset：</p>
<pre class="highlight"><span class="line"><span class="tag">&lt;<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">&quot;Content-Type&quot;</span> <span class="attr">content</span>=<span class="string">&quot;text/html;charset=UTF-8&quot;</span>&gt;</span></span><br></pre>

<p>字符集用meta标签中的<code>charset</code>定义，charset就是character set（即“字符集”），即<strong>网页的编码方式</strong>。</p>
<p><strong>字符集</strong>(Character set)是多个字符的集合。计算机要准确的处理各种字符集文字，需要进行字符编码，以便计算机能够识别和存储各种文字。</p>
<p>上面这行代码非常关键， 是必须要写的代码，否则可能导致乱码。比如你保存的时候，meta写的和声明的不匹配，那么浏览器就是乱码。</p>
<p>utf-8是目前最常用的字符集编码方式，常用的字符集编码方式还有gbk和gb2312等。关于“编码方式”，我们在下一段会详细介绍。</p>
<p>（2）视口 viewport：</p>
<pre class="highlight"><span class="line"><span class="tag">&lt;<span class="name">meta</span> <span class="attr">name</span>=<span class="string">&quot;viewport&quot;</span> <span class="attr">content</span>=<span class="string">&quot;width=device-width, initial-scale=1.0&quot;</span>&gt;</span></span><br></pre>

<p><code>width=device-width</code> ：表示视口宽度等于屏幕宽度。</p>
<p>viewport 这个知识点，初学者还比较难理解，以后学 Web 移动端的时候会用到。</p>
<p>（3）定义“关键词”：</p>
<p>举例如下：</p>
<pre class="highlight"><span class="line"><span class="tag">&lt;<span class="name">meta</span> <span class="attr">name</span>=<span class="string">&quot;Keywords&quot;</span> <span class="attr">content</span>=<span class="string">&quot;网易,邮箱,游戏,新闻,体育,娱乐,女性,亚运,论坛,短信&quot;</span> /&gt;</span></span><br></pre>

<p>这些关键词，就是告诉搜索引擎，这个网页是干嘛的，能够提高搜索命中率。让别人能够找到你，搜索到你。</p>
<p>（4）定义“页面描述”：</p>
<p>meta除了可以设置字符集，还可以设置关键字和页面描述。</p>
<p>只要设置Description页面描述，那么百度搜索结果，就能够显示这些语句，这个技术叫做<strong>SEO</strong>（search engine optimization，搜索引擎优化）。</p>
<p>设置页面描述的举例：</p>
<pre class="highlight"><span class="line"><span class="tag">&lt;<span class="name">meta</span> <span class="attr">name</span>=<span class="string">&quot;Description&quot;</span> <span class="attr">content</span>=<span class="string">&quot;网易是中国领先的互联网技术公司，为用户提供免费邮箱、游戏、搜索引擎服务，开设新闻、娱乐、体育等30多个内容频道，及博客、视频、论坛等互动交流，网聚人的力量。&quot;</span> /&gt;</span></span><br></pre>

<p>效果如下：</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="http://img.smyhvae.com/20170629_1743.png" class="lozad post-image"src="http://img.smyhvae.com/20170629_1743.png"></p>
<p>上面的几种<code>&lt;meta&gt;</code>标签都不用记，但是另外还有一个<code>&lt;meta&gt;</code>标签是需要记住的：</p>
<pre class="highlight"><span class="line"><span class="tag">&lt;<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">&quot;refresh&quot;</span> <span class="attr">content</span>=<span class="string">&quot;3;http://www.baidu.com&quot;</span>&gt;</span></span><br></pre>
<p>上面这个标签的意思是说，3秒之后，自动跳转到百度页面。</p>
<p><strong>title 标签</strong>:</p>
<p>用于设置网页标题：</p>
<pre class="highlight"><span class="line"><span class="tag">&lt;<span class="name">title</span>&gt;</span>网页的标题<span class="tag">&lt;/<span class="name">title</span>&gt;</span></span><br></pre>
<p>title标签也是有助于SEO搜索引擎优化的。</p>
<p><strong>base标签</strong>：</p>
<pre class="highlight"><span class="line"><span class="tag">&lt;<span class="name">base</span> <span class="attr">href</span>=<span class="string">&quot;/&quot;</span>&gt;</span></span><br></pre>

<p>base 标签用于指定基础的路径。指定之后，所有的 a 链接都是以这个路径为基准。</p>
<h3 id="4、-lt-body-gt-标签"><a href="#4、-lt-body-gt-标签" class="headerlink" title="4、&lt;body&gt;标签"></a>4、<code>&lt;body&gt;</code>标签</h3><p><code>&lt;body&gt;</code>标签的属性有：</p>
<ul>
<li><code>bgcolor</code>：设置整个网页的背景颜色。</li>
<li><code>background</code>：设置整个网页的背景图片。</li>
<li><code>text</code>：设置网页中的文本颜色。</li>
<li><code>leftmargin</code>：网页的左边距。IE浏览器默认是8个像素。</li>
<li><code>topmargin</code>：网页的上边距。</li>
<li><code>rightmargin</code>：网页的右边距。</li>
<li><code>bottommargin</code>：网页的下边距。</li>
</ul>
<p><code>&lt;body&gt;</code>标签另外还有一些属性，这里用个例子来解释：</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="http://img.smyhvae.com/2015-10-02-cnblogs_html_39.png" class="lozad post-image"src="http://img.smyhvae.com/2015-10-02-cnblogs_html_39.png"></p>
<p>上方代码中，当我们对<code>点我点我</code>这几个字使用超链时，<code>link</code>属性表示默认显示的颜色、<code>alink</code>属性表示鼠标点击但是还没有松开时的颜色、<code>vlink</code>属性表示点击完成之后显示的颜色。效果如下：</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="http://img.smyhvae.com/2015-10-02-cnblogs_html_05.gif" class="lozad post-image"src="http://img.smyhvae.com/2015-10-02-cnblogs_html_05.gif"></p>
<h2 id="计算机编码介绍"><a href="#计算机编码介绍" class="headerlink" title="计算机编码介绍"></a>计算机编码介绍</h2><p>计算机，不能直接存储文字，存储的是编码。</p>
<p>计算机只能处理二进制的数据，其它数据，比如：0-9、a-z、A-Z，这些字符，我们可以定义一套规则来表示。假如：A用110表示，B用111表示等。</p>
<p><strong>ASCII码：</strong><br>美国发布的，用1个字节(8位二进制)来表示一个字符，共可以表示2^8&#x3D;256个字符。<br>    美国的国家语言是英语，只要能表示0-9、a-z、A-Z、特殊符号。</p>
<p><strong>ANSI编码：</strong><br><strong>每个国家为了显示本国的语言，都对ASCII码进行了扩展</strong>。用2个字节(16位二进制)来表示一个汉字，共可以表示2^16＝65536个汉字。例如：<br>中国的ANSI编码是GB2312编码(简体)，对6763汉字进行编码，含600多特殊字符。另外还有GBK(简体)。<br>日本的ANSI编码是JIS编码。<br>台湾的ANSI编码是BIG5编码（繁体）。</p>
<p><strong>GBK：</strong><br>对GB2312进行了扩展，用来显示罕见的、古汉语的汉字。现在已经收录了2.1万左右。并提供了1890个汉字码位。K的含义就是“扩展”。</p>
<p><strong>Unicode编码(统一编码)：</strong><br>用4个字节(32位二进制)来表示一个字符，想法不错，但效率太低。例如，字母A用ASCII表示的话一个字节就够，可用Unicode编码的话，得用4个字节表示，造成了空间的极大浪费。A的Unicode编码是0000 0000 0000 0000 0000 0000 0100 0000</p>
<p><strong>UTF-8(Unicode Transform Format)编码：</strong><br>根据字符的不同，选择其编码的长度。比如：一个字符A用1个字节表示，一个汉字用2个字节表示。</p>
<p>毫无疑问，开发中，都用<strong>UTF-8</strong>编码吧，准没错。</p>
<p><strong>中文能够使用的字符集两种：</strong></p>
<ul>
<li><p>第一种：UTF-8。UTF-8是国际通用字库，里面涵盖了所有地球上所有人类的语言文字，比如阿拉伯文、汉语、鸟语……</p>
</li>
<li><p>第二种：GBK（对GB2312进行了扩展）。gb2312 是国标，是中国的字库，里面<strong>仅</strong>涵盖了汉字和一些常用外文，比如日文片假名，和常见的符号。</p>
</li>
</ul>
<p>字库规模：  UTF-8（字很全） &gt; gb2312（只有汉字）</p>
<p><strong>重点1：避免乱码</strong></p>
<p>我们用meta标签声明的当前这个html文档的字库，一定要和保存的文件编码类型一样，否则乱码（重点）。</p>
<p>拿 sublime编辑器举例，当我们不设置的时候，sublime默认类型就是UTF-8。而一旦更改为gb2312的时候，就一定要记得设置一下sublime的保存类型： <code>文件→ set File Encoding to → Chinese Simplified(GBK)</code>。VS Code 的道理一样。</p>
<p><strong>重点2：UTF-8和gb2312的比较</strong></p>
<p>保存大小：UTF-8（更臃肿、加载更慢） &gt; gb2312 （更小巧，加载更快）</p>
<p>总结：</p>
<ul>
<li>UTF-8：字多，有各种国家的语言，但是保存尺寸大，文件臃肿；</li>
<li>gb2312：字少，只用中文和少数外语和符号，但是尺寸小，文件小巧。</li>
</ul>
<p>列出2个使用情形：</p>
<p>1） 你们公司是做日本动漫的，经常出现一些日语动漫的名字，网页要使用UTF-8。如果用gb2312将无法显示日语。<br>2） 你们公司就是中文网页，极度的追求网页的显示速度，要使用gb2312。如果使用UTF-8将每个汉字多一个byte，所以5000个汉字，多5kb。</p>
<p>我们亲测：</p>
<ul>
<li>qq网、网易、搜狐都是使用gb2312。这些公司，都追求显示速度。</li>
<li>新华网藏语频道，使用的是UTF-8，保证字符集的数量。</li>
</ul>
<p>我们是怎么查看网页的编码方式的呢？在浏览器中打开网页，右键，选择“查看网页源代码”，找到meta标签中的charset属性即可。</p>
<p>那么，我们为什么可以查看网页的源代码呢？因为这个打开的html网页已经存到我的临时文件夹里了，临时文件夹里的html是纯文本文件，纯文本文件自然可以查看网页的源代码。</p>
<h2 id="HTML的规范"><a href="#HTML的规范" class="headerlink" title="HTML的规范"></a>HTML的规范</h2><ul>
<li>HTML不区分大小写，但HTML的标签名、类名、标签属性、大部分属性值建议统一用小写。</li>
<li>HTML页面的后缀名是html或者htm(有一些系统不支持后缀名长度超过3个字符，比如dos系统)</li>
</ul>
<h3 id="1、编写XHTML的规范："><a href="#1、编写XHTML的规范：" class="headerlink" title="1、编写XHTML的规范："></a>1、编写XHTML的规范：</h3><p>（1）所有标记元素都要正确的嵌套，不能交叉嵌套。正确写法举例：<code>&lt;h1&gt;&lt;font&gt;&lt;/font&gt;&lt;/h1&gt;</code></p>
<p>（2）所有的标记都必须小写。</p>
<p>（3）所有的标签都必须闭合。</p>
<ul>
<li><p>双标签：<code>&lt;span&gt;&lt;/span&gt;</code></p>
</li>
<li><p>单标签：<code>&lt;br&gt;</code> 建议写成 <code>&lt;br /&gt;</code>   <code>&lt;hr&gt;</code> 建议转成 <code>&lt;hr /&gt;</code>，还有<code>&lt;img src=“URL” /&gt;</code></p>
</li>
</ul>
<p>（4）所有的属性值必须加引号。<code>&lt;font  color=&quot;red&quot;&gt;&lt;/font&gt;</code></p>
<p>（5）所有的属性必须有值。<code>&lt;hr noshade=&quot;noshade&quot;&gt;</code>、<code>&lt;input  type=&quot;radio&quot; checked=&quot;checked&quot; /&gt;</code></p>
<p>（6）XHTML文档开头必须要有DTD文档类型定义。</p>
<h3 id="2、HTML的基本语法特性"><a href="#2、HTML的基本语法特性" class="headerlink" title="2、HTML的基本语法特性"></a>2、HTML的基本语法特性</h3><h4 id="（1）HTML对换行不敏感，对tab不敏感"><a href="#（1）HTML对换行不敏感，对tab不敏感" class="headerlink" title="（1）HTML对换行不敏感，对tab不敏感"></a>（1）HTML对换行不敏感，对tab不敏感</h4><p>HTML只在乎标签的嵌套结构，嵌套的关系。谁嵌套了谁，谁被谁嵌套了，和换行、tab无关。换不换行、tab不tab，都不影响页面的结构。</p>
<p>也就是说，HTML不是依靠缩进来表示嵌套的，而是看标签的嵌套关系。但是，我们发现有良好的缩进，代码更易读。建议大家都正确缩进标签。</p>
<p>百度为了追求极致的显示速度，所有HTML标签都没有换行、都没有缩进（tab），HTML和换不换行无关，标签的层次依然清晰，只不过程序员不可读了。如下图所示：</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="http://img.smyhvae.com/20170629_2226.png" class="lozad post-image"src="http://img.smyhvae.com/20170629_2226.png"></p>
<h4 id="（2）空白折叠现象"><a href="#（2）空白折叠现象" class="headerlink" title="（2）空白折叠现象"></a>（2）空白折叠现象</h4><p>HTML中所有的<strong>文字之间</strong>，如果有空格、换行、tab都将被折叠为一个空格显示。</p>
<p>举例如下：</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="http://img.smyhvae.com/20170629_2230.jpg" class="lozad post-image"src="http://img.smyhvae.com/20170629_2230.jpg"></p>
<h4 id="（3）标签要严格封闭"><a href="#（3）标签要严格封闭" class="headerlink" title="（3）标签要严格封闭"></a>（3）标签要严格封闭</h4><p>标签不封闭的结果是灾难性的。</p>
<p>标签不封闭的举例如下：</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="http://img.smyhvae.com/20170629_2245.jpg" class="lozad post-image"src="http://img.smyhvae.com/20170629_2245.jpg"></p>
<h2 id="我的公众号"><a href="#我的公众号" class="headerlink" title="我的公众号"></a>我的公众号</h2><p>想学习<strong>更多技能</strong>？不妨关注我的微信公众号：<strong>千古壹号</strong>（id：<code>qianguyihao</code>）。</p>
<p>扫一扫，你将发现另一个全新的世界，而这将是一场美丽的意外：</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://img.smyhvae.com/20200102.png" class="lozad post-image"src="https://img.smyhvae.com/20200102.png"></p>

  </div>
  <div>
    
      <div 
        class="post-note note-warning copyright" 
        style="margin-top: 42px">
        <p>
          <span style="font-weight: bold;">作者：</span><a 
            target="_blank" 
            rel="nofollow noopener noreferrer" 
            href="/about">
            zwl5670
          </a>
        </p>
        <p>
          <span style="font-weight: bold;">文章链接：</span><a 
            target="_blank" 
            rel="nofollow noopener noreferrer" 
            href="https://zwl5670.gitee.io/2001/01/01/01-HTML/03-%E5%88%9D%E8%AF%86HTML/">
            https://zwl5670.gitee.io/2001/01/01/01-HTML/03-%E5%88%9D%E8%AF%86HTML/
          </a>
        </p>
        <p><span style="font-weight: bold;">版权声明：</span>本博客所有文章除特别声明外，均采用<a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">CC BY-NC-SA 4.0 协议</a>。转载请注明出处！</p>
      </div>
    
  </div>
</article>
<div class="nav">
  
    <div class="nav-item-prev">
      <a 
        href="/2001/01/01/01-HTML/01-%E8%AE%A4%E8%AF%86Web%E5%92%8CWeb%E6%A0%87%E5%87%86/" 
        class="nav-link">
        <i class="iconfont icon-left nav-prev-icon"></i>
        <div>
          <div class="nav-label">上一篇</div>
          
            <div class="nav-title">01-认识Web和Web标准 </div>
          
        </div>
      </a>
    </div>
  
  
    <div class="nav-item-next">
      <a 
        href="/2001/01/01/01-HTML/04-HTML%E6%A0%87%E7%AD%BE%EF%BC%9A%E6%8E%92%E7%89%88%E6%A0%87%E7%AD%BE/" 
        class="nav-link">
        <div>
          <div class="nav-label">下一篇</div>
          
            <div class="nav-title">04-HTML标签：排版标签 </div>
          
        </div>
        <i class="iconfont icon-right nav-next-icon"></i>
      </a>
    </div>
  
</div>

<div 
  class="card card-content toc-card" 
  id="mobiletoc">
  <div class="toc-header">
  <i 
    class="iconfont icon-menu" 
    style="padding-right: 2px;">
  </i>目录
</div>
<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%BC%96%E8%BE%91%E5%99%A8%E7%9B%B8%E5%85%B3"><span class="toc-text">编辑器相关</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#VS-Code-%E7%9A%84%E4%BD%BF%E7%94%A8"><span class="toc-text">VS Code 的使用</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Sublime-Text-%E7%9A%84%E4%BD%BF%E7%94%A8"><span class="toc-text">Sublime Text 的使用</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#HTML%E7%9A%84%E6%A6%82%E8%BF%B0"><span class="toc-text">HTML的概述</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#HTML%E7%9A%84%E6%A6%82%E5%BF%B5"><span class="toc-text">HTML的概念</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%A6%82%E5%BF%B5%EF%BC%9A%E8%B6%85%E6%96%87%E6%9C%AC"><span class="toc-text">概念：超文本</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%A6%82%E5%BF%B5%EF%BC%9A%E6%A0%87%E8%AE%B0%E8%AF%AD%E8%A8%80"><span class="toc-text">概念：标记语言</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#HTML%E6%98%AF%E8%B4%9F%E8%B4%A3%E6%8F%8F%E8%BF%B0%E6%96%87%E6%A1%A3%E8%AF%AD%E4%B9%89%E7%9A%84%E8%AF%AD%E8%A8%80"><span class="toc-text">HTML是负责描述文档语义的语言</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#HTML%E7%9A%84%E5%8E%86%E5%8F%B2"><span class="toc-text">HTML的历史</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#HTML%E7%9A%84%E4%B8%93%E6%9C%89%E5%90%8D%E8%AF%8D"><span class="toc-text">HTML的专有名词</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B9%A6%E5%86%99%E7%AC%AC%E4%B8%80%E4%B8%AA-HTML-%E9%A1%B5%E9%9D%A2"><span class="toc-text">书写第一个 HTML 页面</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#HTML%E7%BB%93%E6%9E%84%E8%AF%A6%E8%A7%A3"><span class="toc-text">HTML结构详解</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#html%E9%AA%A8%E6%9E%B6%E6%A0%87%E7%AD%BE%E5%88%86%E7%B1%BB"><span class="toc-text">html骨架标签分类</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%BF%AB%E9%80%9F%E7%94%9F%E6%88%90-html-%E7%9A%84%E9%AA%A8%E6%9E%B6"><span class="toc-text">快速生成 html 的骨架</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#1%E3%80%81%E6%96%87%E6%A1%A3%E5%A3%B0%E6%98%8E%E5%A4%B4"><span class="toc-text">1、文档声明头</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#HTML4-01%E6%9C%89%E5%93%AA%E4%BA%9B%E8%A7%84%E8%8C%83%E5%91%A2%EF%BC%9F"><span class="toc-text">HTML4.01有哪些规范呢？</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2%E3%80%81%E9%A1%B5%E9%9D%A2%E8%AF%AD%E8%A8%80-lang"><span class="toc-text">2、页面语言 lang</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3%E3%80%81%E5%A4%B4%E6%A0%87%E7%AD%BE-head"><span class="toc-text">3、头标签 head</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#html5-%E7%9A%84%E6%AF%94%E8%BE%83%E5%AE%8C%E6%95%B4%E7%9A%84%E9%AA%A8%E6%9E%B6%EF%BC%9A"><span class="toc-text">html5 的比较完整的骨架：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4%E3%80%81-lt-body-gt-%E6%A0%87%E7%AD%BE"><span class="toc-text">4、&lt;body&gt;标签</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BC%96%E7%A0%81%E4%BB%8B%E7%BB%8D"><span class="toc-text">计算机编码介绍</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#HTML%E7%9A%84%E8%A7%84%E8%8C%83"><span class="toc-text">HTML的规范</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1%E3%80%81%E7%BC%96%E5%86%99XHTML%E7%9A%84%E8%A7%84%E8%8C%83%EF%BC%9A"><span class="toc-text">1、编写XHTML的规范：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2%E3%80%81HTML%E7%9A%84%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95%E7%89%B9%E6%80%A7"><span class="toc-text">2、HTML的基本语法特性</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%EF%BC%881%EF%BC%89HTML%E5%AF%B9%E6%8D%A2%E8%A1%8C%E4%B8%8D%E6%95%8F%E6%84%9F%EF%BC%8C%E5%AF%B9tab%E4%B8%8D%E6%95%8F%E6%84%9F"><span class="toc-text">（1）HTML对换行不敏感，对tab不敏感</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%EF%BC%882%EF%BC%89%E7%A9%BA%E7%99%BD%E6%8A%98%E5%8F%A0%E7%8E%B0%E8%B1%A1"><span class="toc-text">（2）空白折叠现象</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%EF%BC%883%EF%BC%89%E6%A0%87%E7%AD%BE%E8%A6%81%E4%B8%A5%E6%A0%BC%E5%B0%81%E9%97%AD"><span class="toc-text">（3）标签要严格封闭</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%88%91%E7%9A%84%E5%85%AC%E4%BC%97%E5%8F%B7"><span class="toc-text">我的公众号</span></a></li></ol>
</div>
            </main>
            <aside class="right-column">
              <div class="sticky-widescreen">
  
  
    <article class="card card-content toc-card">
      <div class="toc-header">
  <i 
    class="iconfont icon-menu" 
    style="padding-right: 2px;">
  </i>目录
</div>
<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%BC%96%E8%BE%91%E5%99%A8%E7%9B%B8%E5%85%B3"><span class="toc-text">编辑器相关</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#VS-Code-%E7%9A%84%E4%BD%BF%E7%94%A8"><span class="toc-text">VS Code 的使用</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Sublime-Text-%E7%9A%84%E4%BD%BF%E7%94%A8"><span class="toc-text">Sublime Text 的使用</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#HTML%E7%9A%84%E6%A6%82%E8%BF%B0"><span class="toc-text">HTML的概述</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#HTML%E7%9A%84%E6%A6%82%E5%BF%B5"><span class="toc-text">HTML的概念</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%A6%82%E5%BF%B5%EF%BC%9A%E8%B6%85%E6%96%87%E6%9C%AC"><span class="toc-text">概念：超文本</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%A6%82%E5%BF%B5%EF%BC%9A%E6%A0%87%E8%AE%B0%E8%AF%AD%E8%A8%80"><span class="toc-text">概念：标记语言</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#HTML%E6%98%AF%E8%B4%9F%E8%B4%A3%E6%8F%8F%E8%BF%B0%E6%96%87%E6%A1%A3%E8%AF%AD%E4%B9%89%E7%9A%84%E8%AF%AD%E8%A8%80"><span class="toc-text">HTML是负责描述文档语义的语言</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#HTML%E7%9A%84%E5%8E%86%E5%8F%B2"><span class="toc-text">HTML的历史</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#HTML%E7%9A%84%E4%B8%93%E6%9C%89%E5%90%8D%E8%AF%8D"><span class="toc-text">HTML的专有名词</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B9%A6%E5%86%99%E7%AC%AC%E4%B8%80%E4%B8%AA-HTML-%E9%A1%B5%E9%9D%A2"><span class="toc-text">书写第一个 HTML 页面</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#HTML%E7%BB%93%E6%9E%84%E8%AF%A6%E8%A7%A3"><span class="toc-text">HTML结构详解</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#html%E9%AA%A8%E6%9E%B6%E6%A0%87%E7%AD%BE%E5%88%86%E7%B1%BB"><span class="toc-text">html骨架标签分类</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%BF%AB%E9%80%9F%E7%94%9F%E6%88%90-html-%E7%9A%84%E9%AA%A8%E6%9E%B6"><span class="toc-text">快速生成 html 的骨架</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#1%E3%80%81%E6%96%87%E6%A1%A3%E5%A3%B0%E6%98%8E%E5%A4%B4"><span class="toc-text">1、文档声明头</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#HTML4-01%E6%9C%89%E5%93%AA%E4%BA%9B%E8%A7%84%E8%8C%83%E5%91%A2%EF%BC%9F"><span class="toc-text">HTML4.01有哪些规范呢？</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2%E3%80%81%E9%A1%B5%E9%9D%A2%E8%AF%AD%E8%A8%80-lang"><span class="toc-text">2、页面语言 lang</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3%E3%80%81%E5%A4%B4%E6%A0%87%E7%AD%BE-head"><span class="toc-text">3、头标签 head</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#html5-%E7%9A%84%E6%AF%94%E8%BE%83%E5%AE%8C%E6%95%B4%E7%9A%84%E9%AA%A8%E6%9E%B6%EF%BC%9A"><span class="toc-text">html5 的比较完整的骨架：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4%E3%80%81-lt-body-gt-%E6%A0%87%E7%AD%BE"><span class="toc-text">4、&lt;body&gt;标签</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BC%96%E7%A0%81%E4%BB%8B%E7%BB%8D"><span class="toc-text">计算机编码介绍</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#HTML%E7%9A%84%E8%A7%84%E8%8C%83"><span class="toc-text">HTML的规范</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1%E3%80%81%E7%BC%96%E5%86%99XHTML%E7%9A%84%E8%A7%84%E8%8C%83%EF%BC%9A"><span class="toc-text">1、编写XHTML的规范：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2%E3%80%81HTML%E7%9A%84%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95%E7%89%B9%E6%80%A7"><span class="toc-text">2、HTML的基本语法特性</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%EF%BC%881%EF%BC%89HTML%E5%AF%B9%E6%8D%A2%E8%A1%8C%E4%B8%8D%E6%95%8F%E6%84%9F%EF%BC%8C%E5%AF%B9tab%E4%B8%8D%E6%95%8F%E6%84%9F"><span class="toc-text">（1）HTML对换行不敏感，对tab不敏感</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%EF%BC%882%EF%BC%89%E7%A9%BA%E7%99%BD%E6%8A%98%E5%8F%A0%E7%8E%B0%E8%B1%A1"><span class="toc-text">（2）空白折叠现象</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%EF%BC%883%EF%BC%89%E6%A0%87%E7%AD%BE%E8%A6%81%E4%B8%A5%E6%A0%BC%E5%B0%81%E9%97%AD"><span class="toc-text">（3）标签要严格封闭</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%88%91%E7%9A%84%E5%85%AC%E4%BC%97%E5%8F%B7"><span class="toc-text">我的公众号</span></a></li></ol>
    </article>
  
  
  <article class="card card-content">
    <div class="recent-posts-card">
  <div class="recent-posts-header">
    <i 
      class="iconfont icon-wenzhang_huaban" 
      style="padding-right: 2px;">
    </i>最近文章
  </div>
  <div class="recent-posts-list">
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2023-03-09</div>
        <a href="/2023/03/09/13-React%E5%9F%BA%E7%A1%80/11-React%20Navive%E5%88%9D%E8%AF%86/"><div class="recent-posts-item-content">11-React Navive初识</div></a>
      </div>
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2023-03-09</div>
        <a href="/2023/03/09/13-React%E5%9F%BA%E7%A1%80/10-AntD%E6%A1%86%E6%9E%B6%E7%9A%84upload%E7%BB%84%E4%BB%B6%E4%B8%8A%E4%BC%A0%E5%9B%BE%E7%89%87%E6%97%B6%E4%BD%BF%E7%94%A8customRequest%E6%96%B9%E6%B3%95%E8%87%AA%E5%AE%9A%E4%B9%89%E4%B8%8A%E4%BC%A0%E8%A1%8C%E4%B8%BA/"><div class="recent-posts-item-content">10-AntD框架的upload组件上传图片时使用customRequest方法自定义上传行为</div></a>
      </div>
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2023-03-09</div>
        <a href="/2023/03/09/13-React%E5%9F%BA%E7%A1%80/09-AntD%E6%A1%86%E6%9E%B6%E7%9A%84upload%E7%BB%84%E4%BB%B6%E4%B8%8A%E4%BC%A0%E5%9B%BE%E7%89%87%E6%97%B6%E9%81%87%E5%88%B0%E7%9A%84%E4%B8%80%E4%BA%9B%E5%9D%91/"><div class="recent-posts-item-content">09-AntD框架的upload组件上传图片时遇到的一些坑</div></a>
      </div>
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2023-03-09</div>
        <a href="/2023/03/09/13-React%E5%9F%BA%E7%A1%80/08-Ant%20Design%E7%9A%84%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8/"><div class="recent-posts-item-content">08-Ant Design的基本使用</div></a>
      </div>
    
  </div>
</div>
  </article>
  
  
</div>
            </aside>
          </div>
        </div>
      </div>
    </div>
     
    <footer class="footer">
  <div class="footer-container">
    <div>
      <div class="footer-dsc">
        <span>
          Copyright ©
          
            2023
          
          
        </span>
        &nbsp;
        <a 
          href="/" 
          class="footer-link">
          前端面试
        </a>
      </div>
    </div>

    
      <div class="footer-dsc">
        
          Powered by
          <a 
            href="https://hexo.io/" 
            class="footer-link" 
            target="_blank" 
            rel="nofollow noopener noreferrer">
            &nbsp;Hexo
          </a>
        
        
          <span>&nbsp;|&nbsp;</span>
        
        
          Theme -
          <a 
            href="https://github.com/theme-kaze" 
            class="footer-link" 
            target="_blank"
            rel="nofollow noopener noreferrer">
            &nbsp;Kaze
          </a>
        
      </div>
    
    
    
    
</footer>
 
    
  <a 
    role="button" 
    id="scrollbutton" 
    class="basebutton" 
    aria-label="回到顶部">
    <i class="iconfont icon-arrowleft button-icon"></i>
  </a>

<a 
  role="button" 
  id="menubutton"
  aria-label="menu button"
  class="basebutton">
  <i class="iconfont icon-menu button-icon"></i>
</a>
<a 
  role="button" 
  id="popbutton" 
  class="basebutton" 
  aria-label="控制中心">
  <i class="iconfont icon-expand button-icon"></i>
</a>
<a 
  role="button" 
  id="darkbutton" 
  class="basebutton darkwidget" 
  aria-label="夜色模式">
  <i class="iconfont icon-weather button-icon"></i>
</a>
<a 
  role="button" 
  id="searchbutton" 
  class="basebutton searchwidget" 
  aria-label="搜索">
  <i class="iconfont icon-search button-icon"></i>
</a> 
     
     
     
      <script>
  var addImgLayout = function () {
    var img = document.querySelectorAll('.post-content img')
    var i
    for (i = 0; i < img.length; i++) {
      var wrapper = document.createElement('a')
      wrapper.setAttribute('href', img[i].getAttribute('data-src'))
      wrapper.setAttribute('aria-label', 'illustration')
      wrapper.style.cssText =
        'width: 100%; display: flex; justify-content: center;'
      if (img[i].alt) wrapper.dataset.caption = img[i].alt
      wrapper.dataset.nolink = true
      img[i].before(wrapper)
      wrapper.append(img[i])
      var divWrap = document.createElement('div')
      divWrap.classList.add('gallery')
      wrapper.before(divWrap)
      divWrap.append(wrapper)
    }
    baguetteBox.run('.gallery')
  }
</script>
<script>
  loadScript(
    "/js/lib/lightbox/baguetteBox.min.js",
    addImgLayout
  )
</script>
 
     
     
    <script src="/js/main.js"></script> 
     
    
      <script>
        var addLazyload = function () {
          var observer = lozad('.lozad', {
            load: function (el) {
              el.srcset = el.getAttribute('data-src')
            },
            loaded: function (el) {
              el.classList.add('loaded')
            },
          })
          observer.observe()
        }
      </script>
      <script>
        loadScript('/js/lib/lozad.min.js', addLazyload)
      </script>
    
    <script src="//instant.page/5.1.0" type="module"
      integrity="sha384-by67kQnR+pyfy8yWP4kPO12fHKRLHZPfEsiSXR8u2IKcTdxD805MGUXBzVPnkLHw"></script>
    
    
  </body>
</html>
